package ModelLayer;
import java.util.ArrayList;

public class DVD
{
    private int id;
    private String titel;
    private String artist;
    private String releaseDate;
    private ArrayList<Copy> copies;
    
    public DVD(int id, String titel, String artist, String releaseDate)
    {
       copies = new ArrayList<Copy>();
       this.id = id;
       this.titel = titel;
       this.artist = artist;
       this.releaseDate = releaseDate;
    }
    
    public int getId()
    {
        return id;
    }
    
    public String getTitel()
    {
        return titel;
    }
    
    public String getArtist()
    {
        return artist;
    }
    
    public String getReleaseDate()
    {
        return releaseDate;
    }
    
    /**
     * add a copy to copy
     */
    public void addCopies(Copy copy)
    {
        copies.add(copy);
    }
    
    /**
     * Find copy by its serialNumber
     */
    public Copy getCopy(int serialNumber)
    {
        for(Copy c : copies) {
            if(c.getSerialNumber() == serialNumber){
                return c;
            }  
            }
            return null;
    }
    
    public ArrayList<Copy> listAllCopies()
    {
        return copies;
    }
}
